import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'
import vueSetupExtend from 'vite-plugin-vue-setup-extend' // 引入插件

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueSetupExtend(),
    // ...
    AutoImport({
      resolvers: [
        ElementPlusResolver() // 自动导入图标组件
        // IconsResolver({
        //   prefix: 'Icon'
        // })
      ]
    }),
    Components({
      resolvers: [
        // 自动注册图标组件
        IconsResolver(),
        ElementPlusResolver()
      ]
    }),
    Icons()
  ],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  }
})
